<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/3/18
 * Time: 14:11
 */

namespace app\home\model;

use think\Model;
use traits\model\SoftDelete;

class Project extends Model
{
    use SoftDelete;
    // 定义时间戳字段名
    protected $createTime = 'ctime';
    protected $updateTime = '';
    protected $deleteTime = 'deleted';
    // 自动写入时间戳
    protected $autoWriteTimestamp = true;


    public function need()
    {
        return $this->hasMany('ProjectNeed','project_id','id');
    }

    public function bug()
    {
        return $this->hasMany('ProjectBug','project_id','id');
    }

    public function getCreatorAttr($id){
        return \app\common\model\User::where('id',$id)->value('name');
    }

    public function getTaskAllotAttr($value){
        switch ($value) {
            case 0:

            break;
            case 1:

            break;
            case 2:

            break;
            case 3:

            break;
        }
    }
}